package com.x.uikit;


import android.content.Context;
import android.content.Intent;

import com.x.uikit.router.XRoute;
import com.x.uikit.router.XRouteManager;

/**
 * @hide
 */
public class UIKitImpl {
    private Context mAppContext;

    public void setContext(Context context) {
        mAppContext = context;
    }

    public Context getAppContext() {
        return mAppContext;
    }

    public static void navigate(Context context,XRoute route) {
        Intent it = new Intent();
        it.setAction(XRouteManager.ROUTER_ACTION);
        it.putExtra("uikit_route", route);
        if (context != null) {
            context.sendBroadcast(it);
        }
    }

    public static XRoute getRoute(Intent intent) {
        if (intent == null) {
            return null;
        }
        XRoute route = intent.getParcelableExtra("uikit_route");
        return route;
    }

}
